package classfile

type LocalVariableTableAttribute struct {
	attribute_name_index        uint16
	attribute_length            uint32
	local_variable_table_length uint16
	localVariableTable          []*LocalVariableTableEntry
}

type LocalVariableTableEntry struct {
	startPc          uint16
	length           uint16
	name_index       uint16
	descriptor_index uint16
	index            uint16
}

func (self *LocalVariableTableAttribute) readInfo(reader *ClassReader) {
	//self.attribute_name_index = reader.readUint16()
	//self.attribute_length = reader.readUint32()
	self.local_variable_table_length = reader.readUint16()
	self.localVariableTable = make([]*LocalVariableTableEntry, self.local_variable_table_length)
	for i := range self.localVariableTable {
		self.localVariableTable[i] = &LocalVariableTableEntry{
			startPc:          reader.readUint16(),
			length:           reader.readUint16(),
			name_index:       reader.readUint16(),
			descriptor_index: reader.readUint16(),
			index:            reader.readUint16(),
		}
	}
}
